/**
 * 作者: 会写BUG
 * 创作日期: 2025/3/27 22:31
 * 描述: cwbQtPractice.GameButton
 *
 *
 **/

#pragma once

#include <QAbstractButton>

class GameButton
        : public QAbstractButton {

    Q_OBJECT

public:
    explicit GameButton(QWidget * _parent = nullptr);
    explicit GameButton(const QString & _text, QWidget * _parent = nullptr);
    ~GameButton() override;

protected:
    void paintEvent(QPaintEvent *e) override;
    void mousePressEvent(QMouseEvent *e) override;
    void mouseReleaseEvent(QMouseEvent *e) override;
    void enterEvent(QEnterEvent *event) override;
    void leaveEvent(QEvent *event) override;

private:
    /* 按钮抬起动画 */
    void up();
    /* 按钮下沉动画 */
    void down();

private:
    /* 阴影偏移量 */
    int shadow_offset_ = 4;
    /* 按钮当前偏移量 */
    int offset_ = 0;
};
